﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AFSharedLibrary;
using UIDesigner.SurfaceProperties.Operations;
using UIDesigner.SurfaceProperties.Information;

namespace UIDesigner.SurfaceProperties
{
    public static class CreatePropertyDefaults
    {
        public static void ApplyDefaults(SurfacePropertiesBase objSurfaceProperties, Construct objConstruct)
        {
            int x = 0;
            int y = 0;
            CreateProperties objCreateProperties;
            ConstructorOptions eConstructorOptions = ConstructorOptions.OptionsPanel;
            CreateButtonOptions eCreateButtonOptions = CreateButtonOptions.Link;

            eCreateButtonOptions = CreateButtonOptions.Link;
            objCreateProperties = new CreateProperties(eConstructorOptions, eCreateButtonOptions);

            objCreateProperties.ObjectName = objConstruct.Name;
            objCreateProperties.CreateOptions = objSurfaceProperties.CreateProperties.CreateOptions; 

            foreach (ConstructorMapItem objConstructorMapItem in objConstruct.ConstructorMap)
            {
                SurfaceConstructorInfo objSurfaceConstructorInfo = new SurfaceConstructorInfo(objConstructorMapItem);

                y = 0;

                foreach (ParmItem objParmItem in objConstructorMapItem.ParmItems.Values)
                {
                    SurfaceParmInfo objSurfaceParmInfo = null;

                    objSurfaceParmInfo = new SurfaceParmInfo(objParmItem.Name, objParmItem);
                    objSurfaceConstructorInfo.ParmInfos.Add(objSurfaceParmInfo);

                    y++;
                }

                objCreateProperties.ConstructorInfos.Add(objSurfaceConstructorInfo);

                x++;
            }

            objSurfaceProperties.CreateProperties = objCreateProperties;
        }
    }
}
